package com.fly.base;

/**
 * 响应结果生成工具
 */
public class ResultGenerator {

    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";

    public static Result genSuccessResult() {
        return Result.builder()
                .code(ResultCode.SUCCESS.code)
                .message(DEFAULT_SUCCESS_MESSAGE)
                .build();
    }

    public static Result genSuccessResult(Object data) {
        return Result.builder()
                .code(ResultCode.SUCCESS.code)
                .message(DEFAULT_SUCCESS_MESSAGE)
                .data(data)
                .build();
    }

    public static Result genFailResult(String message) {
        return Result.builder()
                .code(ResultCode.FAIL.code)
                .message(message)
                .build();
    }
}
